<template>
  <div>
    <!-- 头部 -->
    <headers title="收藏列表" />
    <!-- 内容 -->
    <house-item
      v-for="item in userFavoriteList"
      :key="item.houseCode"
      :obj="item"
    />
  </div>
</template>

<script>
import Headers from '@/components/Headers.vue'
import HouseItem from '@/components/HouseItem.vue'
import { userFavoritesAPI } from '@/api'
export default {
  name: 'Favorate',
  components: {
    Headers,
    HouseItem
  },
  data() {
    return {
      userFavoriteList: []
    }
  },
  created() {
    this.userFavorites()
  },
  methods: {
    // 获取收藏列表
    async userFavorites() {
      this.$toast.loading({
        message: '加载中...',
        forbidClick: true,
        duration: 100000
      })
      const { body } = await userFavoritesAPI()
      this.userFavoriteList = body
      this.$toast.clear()
    }
  }
}
</script>

<style scoped></style>
